package com.credit.mola.app.utils.sysdata.method

import android.content.Context
import android.os.Build
import com.credit.mola.app.utils.sysdata.utils.SysData6Util
import com.credit.mola.app.utils.sysdata.utils.SysData3Util
import com.credit.mola.app.utils.sysdata.utils.SysData5Util
import com.credit.mola.app.utils.sysdata.utils.SysData4Util
import com.google.gson.Gson

/**
 * device
 */
class SysDataMethod1(val context: Context, val product: String, val token: String, val path: String) {

    fun getDataMethod(): String? {
        return try {
            val data = hashMapOf<String, Any>().apply {
                put("path", path)
                put("token", token)
                put("product", product)
                put("imei", "")
                put("version", "30")
                put("app", product)
                put("manufacturer", Build.MANUFACTURER ?: "")
                put("brand", Build.BRAND ?: "")
                put("deviceName", Build.DEVICE ?: "")
                put("phoneModel", Build.PRODUCT ?: "")
                put("sysVersion", Build.VERSION.RELEASE ?: "")
                put("mac", SysData5Util.getData5Type1())
                put("laguage", SysData6Util.getData6Type3())
                put("area", SysData6Util.getData6Type19())
                put("screenHeight", SysData6Util.getData6Type17(context))
                put("screenWidth", SysData6Util.getData6Type18(context))
                put("networkData", SysData6Util.getData6Type9(context))
                put("frontCameraPixels", SysData3Util.getData3Type10(context))
                put("rearCameraPixels", SysData3Util.getData3Type11(context))
                put("ram", SysData4Util.getData4Type8(context))
                put("rom", SysData4Util.getData4Type11())
                put("ip", SysData5Util.getData5Type2(context))
                put("ip2", SysData5Util.getData5Type2(context))
                put("networkEnvironment", SysData6Util.getData6Type8(context))
                put("cpu", SysData6Util.getData6Type16())
            }
            Gson().toJson(data).trim()

        } catch (e: Exception) {
            null
        }
    }
}